home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / mail / mm / patch.04.Z / patch.04
Encoding:
Text File  |  1992-09-17  |  1.8 KB  |  88 lines

  1. Patch number: 4
  2. MM Version: 0.90
  3. Date: Fri Sep 18 01:38:50 1992
  4. File: file.c
  5.  
  6.  
  7. Description:
  8.  
  9. Security hole involving <filename>.rc (mailfile-specific rc file).
  10.  
  11. Fix:
  12.  
  13. Only take the rc file if it is owned by the user (or root) and the file 
  14. is not group or world writable.
  15.  
  16. Patch:
  17.  
  18. *** 2.20    1991/01/03 10:04:50
  19. --- file.c    1992/09/18 05:30:24
  20. ***************
  21. *** 121,128 ****
  22.   
  23.       cf = nf;                /* make new file current */
  24.    
  25. !     /* "take" filename.rc */
  26. !     (void) take_file(filename, top_level_parser, FALSE);
  27.   
  28.       if (cf) do_flagged();
  29.   
  30. --- 121,129 ----
  31.   
  32.       cf = nf;                /* make new file current */
  33.    
  34. !     /* "take" filename.rc if it is "safe" */
  35. !     if (safe_rc_file(filename))
  36. !     (void) take_file(filename, top_level_parser, FALSE);
  37.   
  38.       if (cf) do_flagged();
  39.   
  40. ***************
  41. *** 1120,1123 ****
  42. --- 1121,1148 ----
  43.       if ((stat(file, &statb) == 0) && (statb.st_size == 0))
  44.       return (TRUE);            /* it's empty */
  45.       return (FALSE);
  46. + }
  47. + /*
  48. +  * safe_rc_file:
  49. +  * filename.rc is "safe" if it is owned either by the user running MM or
  50. +  * if the file is owned by root AND the file is not group or world writable.
  51. +  */
  52. + int
  53. + safe_rc_file(fname)
  54. + char *fname;
  55. + {
  56. +     struct stat sbuf;
  57. +     if (stat(fname, &sbuf) != 0) {
  58. +     return(FALSE);
  59. +     }
  60. +     if (!(sbuf.st_uid == UID || sbuf.st_uid == 0) || 
  61. +     sbuf.st_mode & 022) {
  62. +     fprintf (stderr, "%s not safe, ignoring\n", fname);
  63. +     return(FALSE);
  64. +     }
  65. +     return(TRUE);
  66.   }
  67.  
  68. *** 1.5    1991/01/04 17:17:39
  69. --- mm-patchlevel.h    1992/09/18 05:36:09
  70. ***************
  71. *** 10,13 ****
  72.    * release.  Don't forget to send diffs for this file in the patch file.
  73.    */
  74.   
  75. ! #define MM_PATCH 2
  76. --- 10,13 ----
  77.    * release.  Don't forget to send diffs for this file in the patch file.
  78.    */
  79.   
  80. ! #define MM_PATCH 4
  81.  
  82.  
  83. Note: Patchlevel increased from 2 to 4 (patch 3 involved no diffs).
  84.